oa.view.rf.additionAndSubtractionOfCoins = {
/**
 * Render the structure of an AdditionAndSubtractionOfCoins problem
 *
 * @author Gerd Wagner
 * @param {ArithmeticProblem} ap  An arithmetic problem.
 */
render: function( ap) {
  var el = {};
  var rB = document.getElementById("renderBox");
  var mainEl = dom.createDiv("additionAndSubtractionOfCoins");
  mainEl.setAttribute("data-nmrofops", ap.type.operators.length);
  rB.appendChild( mainEl);
  // operand 1
  el = dom.createSpan("operand1","operand");
  mainEl.appendChild( el);
  // operator
  el = dom.createSpan("","operator");
  mainEl.appendChild( el);
  el.innerHTML = oa.view.operatorSymbols[ ap.type.operators[0]-1];
  // operand 2
  el = dom.createSpan("operand2","operand");
  mainEl.appendChild( el);
  // equality symbol
  el = dom.createSpan("","equalitySymbol","=");
  mainEl.appendChild( el);
  // result
  el = dom.createNumInput("askedFor","askedFor","result");
  mainEl.appendChild( el);
  // configure the input field
  el.setAttribute("autofocus", "autofocus");
  el.addEventListener("input", oa.view.handleUserInputEvents, false);
  el.focus();
  // configure the submit/continue button
  el = dom.createButton("submitButton","blue","?");
  mainEl.appendChild( el);
  el.addEventListener("click", oa.view.handleClickSubmitButtonEvents, false);
  document.addEventListener("keypress", oa.view.handleKeyPressEvents, true);
},

/**
 * Fill an already rendered problem equation with new values for operands and result
 *
 * @author Ciucardel Vasile Costinel
 * @param {ArithmeticProblem} ap  An arithmetic problem.
 */
fill: function( ap) {
  var askedFor = document.getElementById("askedFor");
  askedFor.value = "";
  askedFor.focus();
  // vector for coins value
  var coins = ["50","20","10","5","2","1"];
  // every computed coin for each operand will be stored in this vector
  var computedCoins = new Array();
  // all the computed coins for each operand will be stored in this variable
  var computedCoinsView = "";
  // index for computed coins
  var index = 0;
  var prefix = "<img src=\"media/img/";
  var sufix = "\" />";
  // every operand value will be stored in this variable
  var operandValue = 0;
  // fill in all operands
  for (var i=1; i <= ap.operands.length; i++) {
    // operandValue is initialized with the value of each operand
    operandValue = ap.operands[i-1];
    // In this variable are concatenated the computed coins for every operand
    computedCoinsView = "";
    // In this loop are computed the coins for each value of the operands and added into computedCoinsView
    for(var j=0; j<6; j++) {
      while(operandValue - coins[j] >= 0) {
        computedCoins[index++] = prefix + "coin" + coins[j] + ".png" + sufix;
        computedCoinsView = computedCoinsView + computedCoins[index-1];
        operandValue = operandValue - coins[j];
      }
    }
    if (index > 6) computedCoinsView += "<br />"; 
    document.getElementById("operand"+i).innerHTML = computedCoinsView;
  }
}	
};
